#include <stdio.h>

#define IN   1   /* inside a word */
#define OUT  0   /* outside a word */
#define LEN 10   /* word lengths */
#define H   40   /* maximum horizontal size of histogram */

/* prints a horizontal word length histogram of the input */
main(){
    int i, j, c, K, state;
    long wl[LEN];
    
    /* wl[0] stores count of words at least 10 letters long,
       as there are no 0-length words */

    state = OUT;
    
    for(i=0; i<LEN; ++i)
        wl[i]=0;
    
    while ((c = getchar()) != EOF) {
        if (c == ' ' || c == '\n' || c == '\t'){
            if(state == IN){
                if(i<LEN)
                    ++wl[i];
                else
                    ++wl[0];
            }    
            state = OUT;
        }
        else if(state == OUT) {
            state = IN;
            i=1;
        }
        else if(state == IN)
            ++i;
    }
    
    for(i=1; i<LEN; ++i){
        printf("%d letter(s): %ld ", i, wl[i]);
        if(wl[i]<=H)
            K = wl[i];
        else
            K = H;
        for(j=0; j<K; ++j)
            putchar('*');
        putchar('\n');
    }
    
    printf("10 letters and more: %ld ", wl[0]);
    if(wl[0]<=H)
        K = wl[0];
    else
        K = H;
    for(j=0; j<K; ++j)
        putchar('*');
    putchar('\n');
}
